<template>
	<view class="person-file-details">
		<bs-navbar title='个人档案详情'></bs-navbar>
		<view class="img-box">
			<u-image  :fade="true" duration="450" width="100%" height="556rpx" :src="details.titleImage"></u-image>
		</view>
		<view class="msg-view">
			<msgBox :codeImg='codeImg' :details='details'></msgBox>
		</view>
		<view style="padding: 0 30rpx;margin-top:-106rpx;">
			<bsTileRich title='个人简介' :content='details.individualResume'></bsTileRich>
			<view class="mt-70">
				<bsTileRich title='个人经历' :content='details.workExperience'></bsTileRich>
			</view>
			<view class="mt-70">
				<bsWorksListShow :list='details.production'></bsWorksListShow>
			</view>

		</view>
		<bsShare :recordId='recordId'></bsShare>
	</view>
</template>

<script>
	import {
		share
	} from '@/utils/tools.js'
	import {
		baseImgUrl
	} from '@/config/config.js'
	import msgBox from './components/msg-box.vue'
	import bsTileRich from '@/components/bs-title-rich/bs-title-rich.vue'
	import bsWorksListShow from '@/components/bs-works-list-show/bs-works-list-show.vue'
	import bsShare from '@/components/bs-share/bs-share.vue'
	export default {
		components: {
			msgBox,
			bsTileRich,
			bsWorksListShow,
			bsShare
		},
		onShareAppMessage(res) {
			return {
				title: this.details.recordName + '的档案详情',
			}
		},
		data() {
			return {
				recordId: '',
				details: {},
				codeImg: '',
				imgUrl: this.configImgUrl
			};
		},
		async onLoad(e) {
			console.log(e)
			if (e.recordId) {
				this.recordId = e.recordId
				await this.init()
				await this.getCodeImg()
			}

		},
		methods: {
			async init() {
				let res = await this.$u.api.selectRecord({
					recordId: this.recordId
				})
				this.details = res
				console.log(res, '个人档案详情')
			},
			async getCodeImg() {
				let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
				let curRoute = routes[routes.length - 1].route
				let res = await this.$u.api.getPageCode({
					page: curRoute,
					scene: 'recordId=' + this.recordId
				})
				this.codeImg = baseImgUrl + res
				console.log(this.codeImg)
			}
		}
	}
</script>

<style lang="scss">
	.person-file-details {

		.msg-view {
			position: relative;
			top: -176rpx;
			z-index: 1;
			padding: 0 30rpx;
		}

		.img-box {
			position: relative;

			&::after {
				content: '';
				position: absolute;
				bottom: 0;
				left: 0;
				height: 40%;
				width: 100%;
				background: linear-gradient(180deg, rgba(249, 249, 249, 0.00) 7%, #FFFFFF 100%);
				// background-color: #FFFFFF;
				// opacity: 0.5;
			}
		}
	}
</style>
